package com.qf.hospital.mapper;

import com.qf.hospital.entity.Cashier;
import com.qf.hospital.entity.CashierExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CashierMapper {
    long countByExample(CashierExample example);

    int deleteByExample(CashierExample example);

    int deleteByPrimaryKey(Integer cashierId);

    int insert(Cashier record);

    int insertSelective(Cashier record);

    List<Cashier> selectByExample(CashierExample example);

    Cashier selectByPrimaryKey(Integer cashierId);

    int updateByExampleSelective(@Param("record") Cashier record, @Param("example") CashierExample example);

    int updateByExample(@Param("record") Cashier record, @Param("example") CashierExample example);

    int updateByPrimaryKeySelective(Cashier record);

    int updateByPrimaryKey(Cashier record);

    /**
     * 修改患者出纳信息
     * @param reportId
     * @param pharmacyName
     * @param num
     * @param totalPrice
     */
    @Update("UPDATE cashier set durg_num=durg_num+#{num},repice_total=repice_total+#{totalPrice} WHERE report_id=#{reportId} AND durg_name=#{pharmacyName} AND mstate=0")
    int updateCashierByReportIdAndPharmacyName(@Param("reportId") Integer reportId, @Param("pharmacyName") String pharmacyName, @Param("num") Integer num, @Param("totalPrice") Double totalPrice);
}